/**
 * 
 */
package com.ean.backpack.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.ean.backpack.wsapi.HotelServices;
import com.ean.backpack.wsapi.HotelServicesImplService;
import com.ean.backpack.wsapi.LocaleType;
import com.ean.backpack.wsapi.PingRequest;
import com.ean.backpack.wsapi.PingResponse;

/**
 * @author cristian.daraban
 *
 */

@Controller
public class WsapiController {
	
	@Autowired
	@Qualifier("hotelService")
	private HotelServicesImplService hotelService;
	
	@RequestMapping(value = "/wsapi", method = RequestMethod.GET)
	public String index(ModelMap model) {

		HotelServices port = hotelService.getHotelServicesImplPort();
		PingRequest pingRequest = new PingRequest();
				  
		pingRequest.setApiKey("cbrzfta369qwyrm9t5b8y8kf");
		pingRequest.setCustomerIpAddress("");
		pingRequest.setCustomerSessionId("");
		pingRequest.setCustomerUserAgent("");
		pingRequest.setCurrencyCode("USD");
		pingRequest.setSig(null);
		pingRequest.setEcho("Test Ping");
		pingRequest.setCid(55505);
		pingRequest.setDebug(true);
		pingRequest.setTest(true);
		pingRequest.setLocale(LocaleType.EN_GB);
		pingRequest.setMinorRev(22);
		
		PingResponse pingResponse = port.getPing(pingRequest);
		//System.out.println();
		String res = pingResponse.getEcho();
		model.put("pingStatus", res);
		
		return "wsapi";
	}
	

}
